<div class="row">
    <div class="col-sm-2">
        <label for="templatelist-select-exercisecategory">
            Exercise
        </label>
    </div>    
    <div class="col-sm-10">
        <?php
            FT::select(null,null,array(
                "class" => "form-control",
                "id"    => "templatelist-select-exercisecategory"
            ));
        ?>
    </div>
</div>

<div class="row">
    <div class="col-sm-2">
        <label for="templatelist-select-exerciseid">
            &nbsp;
        </label>
    </div>
    <div class="col-sm-10">
        <?php
            FT::select("exerciseid",null,array(
                "class" => "form-control",
                "id"    => "templatelist-select-exerciseid"
            ));
        ?>
    </div>
</div>

<div class="row">
    <div class="col-sm-2">
        &nbsp;
    </div>
    <div class="col-sm-10">
        <?php
            FT::button("Search",array(
                "class"     => "btn templatelist-button btn-default",
                "id"        => "templatelist-button-search",
                "disabled"  => "disabled"
            ));
        ?>
    </div>
</div>

<div class="container" id="templatelist-div-search"></div>

<?php
    FT::hidden("pos",0,array(
        "id" => "templatelist-input-pos"
    ));
    FT::hidden("count",20,array(
        "id" => "templatelist-input-count"
    ));
?>

<script type="text/javascript">
    $(".form_date").datetimepicker({
        autoclose:      1,
        minView:        2,
        todayBtn:       1,		
		todayHighlight: 1,
        weekStart:      1
    });
    
    // Alusta harjoitteiden alasvetovalikot
    var categories  = ExerciseControl.getExerciseCategories();
    var cat         = Object.keys(categories)[0];
    var arr         = Object.keys(categories[cat])[0].split("|");
    var exercises   = ExerciseControl.getCategoryExercises(arr[0],arr[1]);
    
    $("#templatelist-select-exercisecategory").
        html(FT.options(categories));
    
    $("#templatelist-select-exerciseid").
        html(FT.options(exercises)).
        prepend(
            $("<option>").
                attr("value","0").
                text("- Not selected -")
        );
    
    getViewScript("templatelist",function(){
        viewTemplatelist.initializePage();
		viewTemplatelist.search();
    });
</script>